<?php

require_once('lock.php');
require_once('access_adm.php');
require_once('../php/includes/constants.php');
require_once('../php/includes/db_access.php');
require_once('../php/includes/random_password.php');
require_once('include_adm.php');

error_reporting(0);

//begin script voor bewerk eindproducten 

$db = new Db(SERVER, USERNAME, PASSWORD);

if (isset($_POST['actType']) && ($_POST['actType'] == 'opslaan')) {
    

                if (!empty($_POST['name'])
                && !empty($_POST['type'])
                && !empty($_POST['code'])  
                && !empty($_POST['geldig_van'])
                && !empty($_POST['geldig_tot'])
                ) {

           
            $aValues['naam'] = $_POST['name'];
            $aValues['type'] = $_POST['type'];
            $aValues['waarde'] = $_POST['waarde'];
            $aValues['korting'] = $_POST['korting'];
            $aValues['code'] = $_POST['code'];
            $aValues['geldig_van'] = $_POST['geldig_van'];
            $aValues['geldig_tot'] = $_POST['geldig_tot'];
            $aValues['aktief'] = $_POST['aktief'];
           // $aValues['geldig_tot'] = STR_TO_DATE($_POST['geldig_tot'], '%d/%m/%Y');

            $cadeaubon_id = $db->Insert('cadeaubon', $aValues, '', true);

            header('Location: korting_list.php');
       } else {

           echo "<font color='red'>your kung fu is bad!!</font";
           
            exit;
        }
 
}//eind script voor nieuwe eindproducten 



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="styles/beheer.css" type="text/css" charset="utf-8" media="screen">
<link rel="stylesheet" href="styles/jquery-ui-1.8.18.custom.css" type="text/css" charset="utf-8" media="screen">


    <META NAME="ROBOTS" CONTENT="NOARCHIVE, NOINDEX, NOFOLLOW">
        <META NAME="GOOGLEBOT" CONTENT="NOSNIPPET"> 
            <script type="text/javascript" src="js/jquery-1.4.3.min.js"></script>
            <script type="text/javascript" src="js/jquery-1.7.1.js"></script>
            <script type="text/javascript" src="js/jquery.curvycorners.packed.js"></script>
            <script type="text/javascript" src="js/radius.js"></script>
            <script type="text/javascript" src="js/fout.js"></script>
            <script type="text/javascript" src="js/foutbgone.js"></script>
            <script type="text/javascript" src="js/jquery.ui.core.js"></script>
            <script type="text/javascript" src="js/jquery.ui.widget.js"></script>
            <script type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
            <SCRIPT type="text/javascript">
                <!--

                function checkForm(f) {
                    var re = new RegExp("^[0-9a-z]([-_.]?[0-9a-z_])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,}$",'i');

                    if (f.naam.value == "") {
                        alert( "Je hebt de naam nog niet ingevuld!" );
                        document.getElementById("naam").style.backgroundColor="#708CA2";
                        f.naam.focus();
                        return false ;
                    }
                    
                     if (f.Cadeaubon.value == "") {
                        alert( "Je hebt Cadeaubon waarden nog niet ingevuld!" );
                        document.getElementById("Cadeaubon").style.backgroundColor="#708CA2";
                        f.Cadeaubon.focus();
                        return false ;  
                    }else{
                        if (f.aktie.value == "" ) {
                        alert( "Je hebt Aktie nog niet ingevuld!" );
                        document.getElementById("aktie").style.backgroundColor="#708CA2";
                        f.aktie.focus();
                        return false ;
                    }
                }
                    
                     if (f.datepicker.value == "") {
                        alert( "Je hebt Geldig van nog niet ingevuld!" );
                        document.getElementById("datepicker").style.backgroundColor="#708CA2";
                        f.datepicker.focus();
                        return false ;
                    }
                    
                     if (f.datepicker1.value == "") {
                        alert( "Je hebt Geldig tot nog niet ingevuld!" );
                        document.getElementById("datepicker1").style.backgroundColor="#708CA2";
                        f.datepicker1.focus();
                        return false ;
                    }
                    
                    return true;
                }
                
                  ////jquery datepicker met aangepast datumformaat
  
$(function() {
$('input#datepicker,#datepicker1').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: false,
changeYear: false
},
$.datepicker.regional['nl']);
});

                //-->
            </SCRIPT>
            
            
         
            
            <title>CMS | Hollandsche meesters</title>
            </head>

            <body>

<div id="wrapper">
<div id="container">
<?php include_once 'header.html'; ?>

<div id="content">
<div class="kop">
<h1>CADEAUBON BEWERKEN &amp; TOEVOEGEN  <?php echo strtoupper($kunstwerk); ?></h1>
</div>
<div id="content-box">
<div class="col-964">
<div class="overzicht-box-gr">
<h2 class="radiusTLTR">CADEAUBON</h2>
<div class="box-964 radiusBLBR">

<table width="800" border="0" cellspacing="5" cellpadding="5">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="sform" id="sform" enctype="multipart/form-data" onSubmit="return checkForm(this)">
<input type="hidden" name="actType" value="opslaan">
                                                                            
                <tr>
                    <td width="100" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td width="300" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td width="200" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td width="200" valign="top"> &nbsp;&nbsp;&nbsp;</td>

                </tr>


            <tr>


                <td  valign="top"> Naam:</td>
                <td valign="top">

                    <input type="text" name="name" value="" class="inp" id="naam" onblur="this.style.backgroundColor='#fff';"  style="width:200px" /><font color="red" >*</font>

                </td>
                <td valign="top" colspan="2">
                    (naam aktie of naam ontvanger)
                </td>
            </tr>
                                                                           
                <tr>
                    
                    <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    
                </tr>

            <tr>
              <td  valign="top"> Dit is een:</td>
                <td valign="top">
                    <input name="type" type="radio" value="C" id="Cadeaubon"/> Cadeaubon <br />
                    <input name="type" type="radio" value="A" id="aktie" /> Aktie
               </td>
              <td>
                waarden &nbsp;&nbsp<input type="text" name="waarde" value="" class="inp" onblur="this.style.backgroundColor='#fff';"  style="width:60px" /> &euro;<br />
                korting &nbsp; &nbsp; &nbsp;<input type="text" name="korting" value="" class="inp" onblur="this.style.backgroundColor='#fff';"  style="width:60px" /> %
              </td>
               <td  valign="top"> (een malig gebruik!)</td>
            </tr>
             <tr>
                    
                    <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    
                </tr>

            <tr>
                    <td valign="top"> code: </td>
                    <td valign="top">
                        

                        <input type="text" name="code" value="<?php echo $password;?>" class="inp" onblur="this.style.backgroundColor='#fff';"  style="width:150px" />
                    </td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                </tr>
    
                <tr>
                    <td valign="top"> Geldig van: </td>
                    <td valign="top">  
                        <input type="text" name="geldig_van" value=""  id="datepicker" onblur="this.style.backgroundColor='#fff';"  style="width:150px" /><font color="red" >*</font>
                    </td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                </tr>
                                <tr>
                    <td valign="top"> Geldig tot: </td>
                    <td valign="top">

                        <input type="text" name="geldig_tot" value="" id="datepicker1" onblur="this.style.backgroundColor='#fff';"  style="width:150px" /><font color="red" >*</font>
                    </td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                </tr>
    <tr>
                    
                    <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                    
                </tr>
                    <tr>
                     <td valign="top"> Aktief</td>
                    <td valign="top">
                     <input name="aktief" type="radio" value="Y" /> Ja &nbsp;&nbsp;&nbsp;&nbsp;
                    <input name="aktief" type="radio" value="N" /> Nee
                   </td>
                   <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                   <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                   </tr>

        <tr>
            <td>&nbsp;</td>
            <td align="left">&nbsp;</td>
            <td align="left"><input type="image" name="opslaan" src="images/btn-opslaan.gif" width="67" height="25" class="btn" alt="Opslaan" title="Opslaan" /></td>
            
            <td align="left">&nbsp;</td>
        </tr>
        </form>
        </table>
        </p>
        </div>
        </div>
        </div>		
        </div>
        </div>

        </div>
        </div>

        </body>
        </html>
